package com.vcaresolution.logistic.service;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.vcaresolution.logistic.form.UserGroupForm;
import com.vcaresolution.logistic.pojo.Usergroup;
import com.vcaresolution.logistic.to.UserGroupTO;

@Service
public class UserGroupServiceImpl extends BaseService implements UserGroupService{

	@Override
	public void add(UserGroupForm object) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void delete(UserGroupForm object) {
		// TODO Auto-generated method stub
		
	}

	@Override
	@Transactional
	public List<UserGroupTO> findByAll() {
		List<Usergroup> userList = getDaoFactory().getUtilityDAO().findByAll(Usergroup.class);
		
		List<UserGroupTO> userFormList = new ArrayList<UserGroupTO>();
		
		if( userList != null && !userList.isEmpty() ){
			UserGroupTO userForm = null;
			for(Usergroup usergroup: userList){
				userForm = new UserGroupTO();
				
				BeanUtils.copyProperties(usergroup, userForm);
				userFormList.add(userForm);
			}
		}
		
		return userFormList;
	}

	@Override
	public UserGroupTO findById(Serializable companyID) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void update(UserGroupForm object) {
		// TODO Auto-generated method stub
		
	}

}
